#pragma once
#ifndef TIMER_H
#define TIMER_H

#include <iostream>
#include <chrono>

#include <windows.h>

class Timer
{
public:
	double PCFreq;
	__int64 CounterStart;
	LARGE_INTEGER li;

	Timer() :
		PCFreq(0.f),
		CounterStart(0)
	{
	}

	void StartCounter()
	{

		if(!QueryPerformanceFrequency(&li))
		std::cout << "QueryPerformanceFrequency failed!\n";

		PCFreq = double(li.QuadPart)/1000.0;

		QueryPerformanceCounter(&li);
		CounterStart = li.QuadPart;
	}

	double GetCounter()
	{
		QueryPerformanceCounter(&li);
		return double(li.QuadPart-CounterStart)/PCFreq;
	}
};

#endif